{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "4aaadfaf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "model: qwen3:8b\n",
      "api_base: http://host.docker.internal:11434/v1\n",
      "api_key: 6\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "from dotenv import load_dotenv\n",
    "env_path = \"./\"\n",
    "# 强制制定.env的文件路径，并强制清空系统环境变量的内容 一般用load_dotenv()即可满足要求了\n",
    "load_dotenv(env_path, override=True)\n",
    "\n",
    "model=os.getenv(\"OPENAI_MODEL_NAME\")\n",
    "api_base=os.getenv(\"OPENAI_API_BASE\")\n",
    "api_key=os.getenv(\"OPENAI_API_KEY\")\n",
    "# 打印出来看看\n",
    "print(\"model:\", model)\n",
    "print(\"api_base:\", api_base)\n",
    "print(\"api_key:\", len(api_key))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "466078e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from crewai import Agent\n",
    "from crewai_tools import SerperDevTool"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "cb51b314",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 看源码，vs code 只看大纲的函数，精简显示的设置。 在设置里找到 outline.showVariables\n",
    "# 创建一个包含所有可用参数的智能体（Agent）\n",
    "agent = Agent(\n",
    "    role=\"高级数据科学家\",  # 定义智能体在团队中的职能和专业知识。\n",
    "    goal=\"分析和解读复杂数据集，提供可执行的见解\",  # 指导智能体决策的个人目标。\n",
    "    backstory=\"拥有超过10年的数据科学和机器学习经验，\"\n",
    "              \"擅长在复杂数据集中发现规律。\",  # 背景故事为智能体提供背景和个性，丰富交互体验。\n",
    "    llm=\"gpt-4\",  # 大语言模型，默认值为OPENAI_MODEL_NAME或\"gpt-4\"\n",
    "    function_calling_llm=None,  # 可选参数：用于工具调用的独立大语言模型\n",
    "    verbose=False,  # 详细日志模式，默认值为False\n",
    "    allow_delegation=False,  # 是否允许智能体将任务委派给其他智能体。默认为 False。\n",
    "    max_iter=20,  # 智能体在必须给出最佳答案之前的最大迭代次数。默认为 20。\n",
    "    max_rpm=None,  # 可选参数 每分钟最大请求数，以避免速率限制。\n",
    "    max_execution_time=None,  # 可选参数：\t任务执行的最大时间（秒）。\n",
    "    max_retry_limit=2,  # 错误时的最大重试次数，默认值为2次\n",
    "    allow_code_execution=False,  # 为智能体启用代码执行。默认为 False。\n",
    "    code_execution_mode=\"safe\",  # 代码执行模式：‘safe’（使用 Docker）或‘unsafe’（直接执行）。默认为‘safe’。\n",
    "    respect_context_window=True,  # 是否遵守上下文窗口限制，默认值为True\n",
    "    use_system_prompt=True,  # 是否使用系统提示词，默认值为True\n",
    "    multimodal=False,  # 是否支持多模态（文本、图像等），默认值为False\n",
    "    inject_date=False,  # 是否在提示中注入当前日期，默认值为False\n",
    "    date_format=\"%Y-%m-%d\",  # 日期格式，默认值为ISO格式\n",
    "    reasoning=False,  #  智能体在执行任务前是否应进行反思并制定计划。默认为 False。\n",
    "    max_reasoning_attempts=None,  # 在执行任务前的最大推理尝试次数。如果为 None，则会一直尝试直到准备就绪。\n",
    "    tools=[SerperDevTool()],  # 可选参数：智能体可使用的工具列表\n",
    "    knowledge_sources=None,  # 可选参数： 智能体可用的知识源。\n",
    "    embedder=None,  # 可选参数：自定义嵌入模型配置\n",
    "    system_template=None,  # 可选参数：自定义系统提示词模板\n",
    "    prompt_template=None,  # 可选参数：自定义提示词模板\n",
    "    response_template=None,  # 可选参数：自定义响应模板\n",
    "    step_callback=None,  # 可选参数：用于监控的步骤回调函数\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "id": "731b0b72",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 基础研究智能体\n",
    "research_agent = Agent(\n",
    "    role=\"研究分析师\",\n",
    "    goal=\"查找并总结特定主题的信息\",\n",
    "    backstory=\"你是一名注重细节的资深研究员\",\n",
    "    tools=[SerperDevTool()], # 可供工具调用的列表\n",
    "    verbose=True  # 详细打印日志\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "310e8e04",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 研发的智能体\n",
    "research_agent = Agent(\n",
    "    role=\"研究分析师\",\n",
    "    goal=\"查找并总结特定主题的相关信息\",\n",
    "    backstory=\"你是一名经验丰富且注重细节的研究员\", \n",
    "    tools=[SerperDevTool()],# 可供工具调用的列表\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "d2e926b3",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 长时运行分析智能体\n",
    "analysis_agent = Agent(\n",
    "    role=\"数据分析师\",\n",
    "    goal=\"对大型数据集进行深度分析\",\n",
    "    backstory=\"擅长大数据分析与模式识别\",\n",
    "    memory=True,  # 这里要打开记忆功能\n",
    "    respect_context_window=True,  # 遵守上下文窗口限制\n",
    "    max_rpm=10,  # API调用限制：每分钟最多10次\n",
    "    function_calling_llm=\"gpt-4o-mini\" \n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "0b906796",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 自定义模板的智能体\n",
    "custom_agent = Agent(\n",
    "    role=\"客户服务代表\",\n",
    "    goal=\"协助客户解决他们的咨询问题\", \n",
    "    backstory=\"在客户支持方面经验丰富，注重客户满意度\",\n",
    "    system_template=\"\"\"<|start_header_id|>system<|end_header_id|>\n",
    "                        {{ .System }}<|eot_id|>\"\"\",  # 系统模板：保留特殊标识（如<|start_header_id|>）和变量格式，确保模板解析正常\n",
    "    prompt_template=\"\"\"<|start_header_id|>user<|end_header_id|>\n",
    "                        {{ .Prompt }}<|eot_id|>\"\"\",  # 用户提示模板：同上，保留技术格式\n",
    "    response_template=\"\"\"<|start_header_id|>assistant<|end_header_id|>\n",
    "                        {{ .Response }}<|eot_id|>\"\"\",  # 助手响应模板：保留特殊标识和变量，确保对话格式正确\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "id": "6b862492",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 具备日期感知和推理能力的智能体\n",
    "strategic_agent = Agent(\n",
    "    role=\"市场分析师\",\n",
    "    goal=\"结合精确日期参考追踪市场动态并进行战略规划\", \n",
    "    backstory=\"擅长时效性金融分析与战略报告撰写的专家\",\n",
    "    inject_date=True,  # 自动注入当前日期：保留参数名，确保功能生效（自动在任务中加入当前日期）\n",
    "    date_format=\"%B %d, %Y\",  # 日期格式：保留格式化语法（如\"%B\"表示月份全称），对应\"May 21, 2025\"样式\n",
    "    reasoning=True,  # 启用战略规划\n",
    "    max_reasoning_attempts=2,  # 规划迭代次数限制：最多2次\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "id": "ba4a7fbc",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# 推理智能体\n",
    "reasoning_agent = Agent(\n",
    "    role=\"战略规划师\",\n",
    "    goal=\"分析复杂问题并制定详细的执行计划\",\n",
    "    backstory=\"擅长系统拆解复杂挑战的资深战略规划专家\",\n",
    "    reasoning=True,\n",
    "    max_reasoning_attempts=3,  # 推理尝试次数限制：最多3次（控制推理迭代上限）\n",
    "    max_iter=30,  # 最大迭代次数：为复杂规划预留更多迭代空间\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "e3028e43",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 多模态智能体\n",
    "multimodal_agent = Agent(\n",
    "    role=\"视觉内容分析师\",\n",
    "    goal=\"分析并处理文本与视觉两类内容\",\n",
    "    backstory=\"专长于结合文本理解与图像理解的多模态分析领域\",\n",
    "    multimodal=True,  # 启用多模态能力：保留参数名，确保开启文本+视觉的综合处理功能\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "89b6823b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# role、goal 和 backstory 是必需的，它们塑造了智能体的行为。\n",
    "\n",
    "# 记忆与上下文\n",
    "# memory：启用以维持对话历史\n",
    "# respect_context_window：防止 token 限制问题\n",
    "# knowledge_sources：添加领域特定的知识库\n",
    "\n",
    "\n",
    "# 执行控制\n",
    "# max_iter：在给出最佳答案前的最大尝试次数\n",
    "# max_execution_time：以秒为单位的超时时间\n",
    "# max_rpm：API 调用的速率限制\n",
    "# max_retry_limit：出错时的重试次数\n",
    "\n",
    "\n",
    "# 代码执行\n",
    "# allow_code_execution：必须为 True 才能运行代码\n",
    "# code_execution_mode:\n",
    "# \"safe\"：使用 Docker（推荐用于生产环境）\n",
    "# \"unsafe\"：直接执行（仅在受信任的环境中使用）\n",
    "\n",
    "\n",
    "# 高级功能\n",
    "# multimodal：启用多模态能力以处理文本和视觉内容\n",
    "# reasoning：使智能体在执行任务前能够进行反思并制定计划\n",
    "# inject_date：自动将当前日期注入任务描述中\n",
    "\n",
    "\n",
    "# 模板\n",
    "# system_template：定义智能体的核心行为\n",
    "# prompt_template：构建输入格式\n",
    "# response_template：格式化智能体响应\n",
    "\n",
    "# 智能体的工具\n",
    "# crewai的 https://github.com/crewAIInc/crewAI-tools\n",
    "# langchain的工具 https://python.langchain.ac.cn/docs/integrations/tools/\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "d40ca2b1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 智能体记忆与上下文\n",
    "# 智能体可以保持其交互的记忆，并使用先前任务的上下文。这对于需要在多个任务之间保留信息的复杂工作流特别有用。\n",
    "analyst = Agent(\n",
    "    role=\"数据分析师\",\n",
    "    goal=\"分析并记住复杂的数据模式\",\n",
    "    backstory=\"在数据方面经验丰富，注重客户满意度\",\n",
    "    memory=True,  # 开启记忆\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "5415a867",
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "\n",
    "上下文窗口管理\n",
    "CrewAI 包含先进的自动上下文窗口管理功能，以处理对话超出语言模型 token 限制的情况。这个强大的功能由 respect_context_window 参数控制。\n",
    "\n",
    "上下文窗口管理如何工作\n",
    "当智能体的对话历史对于 LLM 的上下文窗口来说过大时，CrewAI 会自动检测到这种情况，并可以：\n",
    "自动摘要内容 (当 respect_context_window=True)\n",
    "停止执行并报错 (当 respect_context_window=False)\n",
    "\n",
    "自动上下文处理 (respect_context_window=True)\n",
    "这是大多数用例的默认和推荐设置。\n",
    "\"\"\"\n",
    "smart_agent = Agent(\n",
    "    role=\"Research Analyst\",\n",
    "    goal=\"Analyze large documents and datasets\",\n",
    "    backstory=\"Expert at processing extensive information\",\n",
    "    respect_context_window=True,  # 🔑 Default: auto-handle context limits\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "7774b7fe",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 当超出上下文限制时会发生什么\n",
    "# ⚠️ 警告消息: \"上下文长度超出。正在摘要内容以适应模型上下文窗口。\"\n",
    "# 🔄 自动摘要：CrewAI 智能地摘要对话历史\n",
    "# ✅ 继续执行：任务执行使用摘要后的上下文无缝继续\n",
    "# 📝 保留信息：在减少 token 数量的同时保留关键信息\n",
    "# ​\n",
    "# 严格的上下文限制 (respect_context_window=False)\n",
    "strict_agent = Agent(\n",
    "    role=\"法律文件审核员\",\n",
    "    goal=\"提供精准的法律分析，不遗漏任何信息\",\n",
    "    backstory=\"需要完整上下文才能做出准确分析的法律专家\",\n",
    "    respect_context_window=False,  # ❌ 当达到上下文限制时停止执行（不自动处理上下文超限）\n",
    "    verbose=True\n",
    ")\n",
    "# 当超出上下文限制时会发生什么\n",
    "# ❌ 错误消息: \"上下文长度超出。考虑使用更小的文本或来自 crewai_tools 的 RAG 工具。\"\n",
    "# 🛑 执行停止：任务执行立即停止\n",
    "# 🔧 需要手动干预：您需要修改您的方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "b90c81c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# 在以下情况下使用 respect_context_window=True (默认)：\n",
    "# 处理可能超出上下文限制的大型文档\n",
    "# 长时间运行的对话，其中一些摘要是可以接受的\n",
    "# 研究任务，其中一般上下文比确切细节更重要\n",
    "# 原型设计和开发，您希望执行具有鲁棒性\n",
    "document_processor = Agent(\n",
    "    role=\"文档分析师\", \n",
    "    goal=\"从大型研究论文中提取洞见\", \n",
    "    backstory=\"擅长分析海量文档的专家\",\n",
    "    respect_context_window=True,  # 优雅地处理大型文档（自动管理上下文窗口，避免超限）\n",
    "    max_iter=50,  # 允许更多迭代次数以应对复杂分析（最多执行50步思考/操作）\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "cdb8f1e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 在以下情况下使用 respect_context_window=False：\n",
    "# 精度至关重要且信息丢失不可接受\n",
    "# 需要完整上下文的 法律或医疗任务 \n",
    "# 代码审查，其中缺失的细节可能引入错误\n",
    "# 金融分析，其中准确性至关重要\n",
    "precision_agent = Agent(\n",
    "    role=\"代码安全审计员\",\n",
    "    goal=\"识别代码中的安全漏洞\",\n",
    "    backstory=\"需要完整代码上下文的安全专家\",\n",
    "    respect_context_window=False,  # 宁肯分析失败也不接受不完整的分析（不自动处理上下文超限）\n",
    "    max_retry_limit=1,  # 遇到上下文问题时快速失败（最多重试1次） 避免无效循环（代码审计中不完整的结果比没有结果更危险，可能误导用户）\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "5d5571e2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 处理大数据集的替代方法\n",
    "# 在处理非常大的数据集时，请考虑以下策略：\n",
    "# 1. 使用 RAG 工具\n",
    "from crewai_tools import RagTool\n",
    "# Create RAG tool for large document processing\n",
    "# uv pip install qdrant-client==1.15.1 --system\n",
    "rag_tool = RagTool()\n",
    "\n",
    "rag_agent = Agent(\n",
    "    role=\"研究助手\",\n",
    "    goal=\"高效查询大型知识库\",\n",
    "    backstory=\"擅长使用RAG工具进行信息检索的专家\",  # 智能体的背景故事：精通基于RAG（检索增强生成）工具的信息获取\n",
    "    tools=[rag_tool],  # 使用RAG工具（而非依赖大上下文窗口）\n",
    "    respect_context_window=True,  # 遵循上下文窗口限制（配合RAG工具优化信息处理）\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "0de7780f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 2. 使用知识源\n",
    "knowledge_agent = Agent(\n",
    "    role=\"Knowledge Expert\",\n",
    "    goal=\"Answer questions using curated knowledge\",\n",
    "    backstory=\"Expert at leveraging structured knowledge sources\",\n",
    "    knowledge_sources=[],  # Pre-processed knowledge\n",
    "    respect_context_window=True,\n",
    "    verbose=True\n",
    ")\n",
    "\n",
    "# 上下文窗口最佳实践\n",
    "# 监控上下文使用情况：启用 verbose=True 以查看上下文管理的实际操作\n",
    "# 设计以提高效率：构建任务以最小化上下文累积\n",
    "# 使用合适的模型：选择具有适合您任务的上下文窗口的 LLM\n",
    "# 测试两种设置：尝试 True 和 False，看看哪种更适合您的用例\n",
    "# 与 RAG 结合使用：对于非常大的数据集，使用 RAG 工具，而不是仅仅依赖上下文窗口"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "30bf5112",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 上下文问题故障排除\n",
    "# 如果您遇到上下文限制错误：\n",
    "# Quick fix: Enable automatic handling\n",
    "agent.respect_context_window = True\n",
    "\n",
    "# Better solution: Use RAG tools for large data\n",
    "from crewai_tools import RagTool\n",
    "agent.tools = [RagTool()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "564c101a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 如果自动摘要丢失了重要信息：\n",
    "agent = Agent(\n",
    "    role=\"详细分析师\", \n",
    "    goal=\"保证信息的完全准确性\",\n",
    "    backstory=\"需要完整上下文的专家\",  # 智能体的背景故事：必须依托全部上下文才能开展工作的专家\n",
    "    respect_context_window=False,  # 不进行信息摘要（禁用自动上下文管理，避免内容被截断或精简）\n",
    "    tools=[RagTool()],  # 使用RAG工具处理大量数据（通过检索增强生成应对大规模信息）\n",
    "    verbose=True\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "8b02a528",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────── LiteAgent Started ───────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">LiteAgent Session Started</span>                                                                                      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Name: </span><span style=\"color: #008080; text-decoration-color: #008080\">人工智能技术研究员</span>                                                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">id: </span><span style=\"color: #008080; text-decoration-color: #008080\">bef1ce9b-cd99-47d6-8ad7-eea01bfa2363</span>                                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">role: </span><span style=\"color: #008080; text-decoration-color: #008080\">人工智能技术研究员</span>                                                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">goal: </span><span style=\"color: #008080; text-decoration-color: #008080\">研究最新的人工智能发展动态</span>                                                                               <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">backstory: </span>                                                                                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">拥有10年AI领域研究经验，专注于自然语言处理和大语言模型方向，擅长跟踪学术前沿和产业动态，能快速筛选有价值的信</span>   <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">息。</span>                                                                                                           <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">tools: </span><span style=\"color: #008080; text-decoration-color: #008080\">[CrewStructuredTool(name='Search the internet with Serper', description='Tool Name: Search the </span>         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">internet with Serper</span>                                                                                           <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">Tool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the </span>        <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">internet', 'type': 'str'}}</span>                                                                                     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">Tool Description: A tool that can be used to search the internet with a search_query. Supports different </span>      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #008080; text-decoration-color: #008080\">search types: 'search' (default), 'news'')]</span>                                                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">verbose: </span><span style=\"color: #008080; text-decoration-color: #008080\">True</span>                                                                                                  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Tool Args: </span>                                                                                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────\u001b[0m\u001b[36m LiteAgent Started \u001b[0m\u001b[36m──────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
       "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[1;36mLiteAgent Session Started\u001b[0m                                                                                      \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mName: \u001b[0m\u001b[36m人工智能技术研究员\u001b[0m                                                                                       \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mid: \u001b[0m\u001b[36mbef1ce9b-cd99-47d6-8ad7-eea01bfa2363\u001b[0m                                                                       \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mrole: \u001b[0m\u001b[36m人工智能技术研究员\u001b[0m                                                                                       \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mgoal: \u001b[0m\u001b[36m研究最新的人工智能发展动态\u001b[0m                                                                               \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mbackstory: \u001b[0m                                                                                                    \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36m拥有10年AI领域研究经验，专注于自然语言处理和大语言模型方向，擅长跟踪学术前沿和产业动态，能快速筛选有价值的信\u001b[0m   \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36m息。\u001b[0m                                                                                                           \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mtools: \u001b[0m\u001b[36m[CrewStructuredTool(name='Search the internet with Serper', description='Tool Name: Search the \u001b[0m         \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36minternet with Serper\u001b[0m                                                                                           \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36mTool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the \u001b[0m        \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36minternet', 'type': 'str'}}\u001b[0m                                                                                     \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36mTool Description: A tool that can be used to search the internet with a search_query. Supports different \u001b[0m      \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[36msearch types: 'search' (default), 'news'')]\u001b[0m                                                                    \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mverbose: \u001b[0m\u001b[36mTrue\u001b[0m                                                                                                  \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m  \u001b[37mTool Args: \u001b[0m                                                                                                    \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
       "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
       "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080\">╭──────────────────────────────────────────── 🔧 Agent Tool Execution ────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>                                                                                                                 <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Agent: </span><span style=\"color: #00ff00; text-decoration-color: #00ff00; font-weight: bold\">人工智能技术研究员</span>                                                                                      <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>                                                                                                                 <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Thought: </span><span style=\"color: #00ff00; text-decoration-color: #00ff00\">&lt;think&gt;</span>                                                                                               <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">好的，用户问的是语言模型的最新发展有哪些。我需要先明确用户的需求，他们可能是在做相关领域的研究，或者想了解当</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">前的技术趋势。首先，我应该用提供的工具搜索最新的信息。</span>                                                         <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">首先，我应该使用“Search the internet with Serper”工具，搜索关键词“语言模型 最新发展”或者“latest advancements </span>  <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">in language </span>                                                                                                   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">models”。可能需要指定搜索类型为news，以获取最近的动态。比如，大模型的参数规模、训练数据、应用领域的新进展，或</span>  <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">者像多模态、少样本学习、推理能力提升这些方向。</span>                                                                 <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">然后，我需要考虑是否需要细分不同的子领域，比如自然语言处理中的具体技术，如预训练模型、微调方法、对话系统等。</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">另外，可能还要关注一些重要的会议或论文，比如NeurIPS、ICML上的最新研究成果，或者行业内的重大发布，比如Google、</span>  <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">Meta、OpenAI等公司的新模型。</span>                                                                                   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">不过，用户可能更关注的是2023年或2024年的进展，所以搜索时要注意时间范围。此外，可能还要提到一些实际应用中的突</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">破，比如更高效的推理机制、更少的计算资源需求，或者在特定领域的定制化模型。</span>                                     <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">在搜索结果中，可能会发现像大模型的参数量继续增加，但同时也有研究关注模型压缩和效率。另外，多模态模型的发展，</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">如结合文本、图像、视频等，也是一个热点。还有，对于伦理和安全方面的改进，比如减少偏见、提升透明度等，也是近期</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">的关注点。</span>                                                                                                     <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">需要确保信息的准确性和时效性，可能需要查阅最近的新闻报道或学术论文。如果搜索结果中有多个来源提到同一趋势，比</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">如参数量的增长、多模态能力的提升，那么这些应该是重点。同时，也要注意是否有新兴的技术方向，比如强化学习在语言</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">模型中的应用，或者与其他AI技术（如生成式AI）的结合。</span>                                                           <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">最后，整理这些信息，分点列出最新的发展，确保覆盖主要的技术方向和应用进展，同时保持回答的清晰和结构化。可能需</span>   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">要检查是否有遗漏的重要趋势，比如模型的可解释性或部署上的优化，确保回答全面且符合用户的需求。</span>                   <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">&lt;/think&gt;</span>                                                                                                       <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">Thought: 我需要查找关于语言模型最新发展的信息，包括技术突破、应用场景和行业动态。</span>                              <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>                                                                                                                 <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Using Tool: </span><span style=\"color: #00ff00; text-decoration-color: #00ff00; font-weight: bold\">Search the internet with Serper</span>                                                                    <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">│</span>                                                                                                                 <span style=\"color: #800080; text-decoration-color: #800080\">│</span>\n",
       "<span style=\"color: #800080; text-decoration-color: #800080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[35m╭─\u001b[0m\u001b[35m───────────────────────────────────────────\u001b[0m\u001b[35m 🔧 Agent Tool Execution \u001b[0m\u001b[35m───────────────────────────────────────────\u001b[0m\u001b[35m─╮\u001b[0m\n",
       "\u001b[35m│\u001b[0m                                                                                                                 \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[37mAgent: \u001b[0m\u001b[1;92m人工智能技术研究员\u001b[0m                                                                                      \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m                                                                                                                 \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[37mThought: \u001b[0m\u001b[92m<think>\u001b[0m                                                                                               \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m好的，用户问的是语言模型的最新发展有哪些。我需要先明确用户的需求，他们可能是在做相关领域的研究，或者想了解当\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m前的技术趋势。首先，我应该用提供的工具搜索最新的信息。\u001b[0m                                                         \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m首先，我应该使用“Search the internet with Serper”工具，搜索关键词“语言模型 最新发展”或者“latest advancements \u001b[0m  \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92min language \u001b[0m                                                                                                   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92mmodels”。可能需要指定搜索类型为news，以获取最近的动态。比如，大模型的参数规模、训练数据、应用领域的新进展，或\u001b[0m  \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m者像多模态、少样本学习、推理能力提升这些方向。\u001b[0m                                                                 \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m然后，我需要考虑是否需要细分不同的子领域，比如自然语言处理中的具体技术，如预训练模型、微调方法、对话系统等。\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m另外，可能还要关注一些重要的会议或论文，比如NeurIPS、ICML上的最新研究成果，或者行业内的重大发布，比如Google、\u001b[0m  \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92mMeta、OpenAI等公司的新模型。\u001b[0m                                                                                   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m不过，用户可能更关注的是2023年或2024年的进展，所以搜索时要注意时间范围。此外，可能还要提到一些实际应用中的突\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m破，比如更高效的推理机制、更少的计算资源需求，或者在特定领域的定制化模型。\u001b[0m                                     \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m在搜索结果中，可能会发现像大模型的参数量继续增加，但同时也有研究关注模型压缩和效率。另外，多模态模型的发展，\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m如结合文本、图像、视频等，也是一个热点。还有，对于伦理和安全方面的改进，比如减少偏见、提升透明度等，也是近期\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m的关注点。\u001b[0m                                                                                                     \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m需要确保信息的准确性和时效性，可能需要查阅最近的新闻报道或学术论文。如果搜索结果中有多个来源提到同一趋势，比\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m如参数量的增长、多模态能力的提升，那么这些应该是重点。同时，也要注意是否有新兴的技术方向，比如强化学习在语言\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m模型中的应用，或者与其他AI技术（如生成式AI）的结合。\u001b[0m                                                           \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m最后，整理这些信息，分点列出最新的发展，确保覆盖主要的技术方向和应用进展，同时保持回答的清晰和结构化。可能需\u001b[0m   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m要检查是否有遗漏的重要趋势，比如模型的可解释性或部署上的优化，确保回答全面且符合用户的需求。\u001b[0m                   \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92m</think>\u001b[0m                                                                                                       \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[92mThought: 我需要查找关于语言模型最新发展的信息，包括技术突破、应用场景和行业动态。\u001b[0m                              \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m                                                                                                                 \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m  \u001b[37mUsing Tool: \u001b[0m\u001b[1;92mSearch the internet with Serper\u001b[0m                                                                    \u001b[35m│\u001b[0m\n",
       "\u001b[35m│\u001b[0m                                                                                                                 \u001b[35m│\u001b[0m\n",
       "\u001b[35m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #000080; text-decoration-color: #000080\">╭────────────────────────────────────────────────── Tool Input ───────────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                                                                                                 <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>  <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">{</span>                                                                                                              <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>  <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">  </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #ffffff\">\"search_query\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">: </span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #ffffff\">\"语言模型 最新发展 2024\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">,</span>                                                                    <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>  <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">  </span><span style=\"color: #ff4689; text-decoration-color: #ff4689; background-color: #ffffff\">\"search_type\"</span><span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">: </span><span style=\"color: #e6db74; text-decoration-color: #e6db74; background-color: #ffffff\">\"news\"</span>                                                                                        <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>  <span style=\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #ffffff\">}</span>                                                                                                              <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">│</span>                                                                                                                 <span style=\"color: #000080; text-decoration-color: #000080\">│</span>\n",
       "<span style=\"color: #000080; text-decoration-color: #000080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[34m╭─\u001b[0m\u001b[34m─────────────────────────────────────────────────\u001b[0m\u001b[34m Tool Input \u001b[0m\u001b[34m──────────────────────────────────────────────────\u001b[0m\u001b[34m─╮\u001b[0m\n",
       "\u001b[34m│\u001b[0m                                                                                                                 \u001b[34m│\u001b[0m\n",
       "\u001b[34m│\u001b[0m  \u001b[38;2;248;248;242;49m{\u001b[0m                                                                                                              \u001b[34m│\u001b[0m\n",
       "\u001b[34m│\u001b[0m  \u001b[38;2;248;248;242;49m  \u001b[0m\u001b[38;2;255;70;137;49m\"search_query\"\u001b[0m\u001b[38;2;248;248;242;49m:\u001b[0m\u001b[38;2;248;248;242;49m \u001b[0m\u001b[38;2;230;219;116;49m\"语言模型 最新发展 2024\"\u001b[0m\u001b[38;2;248;248;242;49m,\u001b[0m                                                                    \u001b[34m│\u001b[0m\n",
       "\u001b[34m│\u001b[0m  \u001b[38;2;248;248;242;49m  \u001b[0m\u001b[38;2;255;70;137;49m\"search_type\"\u001b[0m\u001b[38;2;248;248;242;49m:\u001b[0m\u001b[38;2;248;248;242;49m \u001b[0m\u001b[38;2;230;219;116;49m\"news\"\u001b[0m                                                                                        \u001b[34m│\u001b[0m\n",
       "\u001b[34m│\u001b[0m  \u001b[38;2;248;248;242;49m}\u001b[0m                                                                                                              \u001b[34m│\u001b[0m\n",
       "\u001b[34m│\u001b[0m                                                                                                                 \u001b[34m│\u001b[0m\n",
       "\u001b[34m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭────────────────────────────────────────────────── Tool Output ──────────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">{'searchParameters': {'q': '语言模型 最新发展 2024', 'type': 'search', 'num': 10, 'engine': 'google'}, </span>        <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'organic': [{'title': '群英荟萃：盘点2024年的大语言模型 - 知乎专栏', 'link': </span>                                  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://zhuanlan.zhihu.com/p/13697531310', 'snippet': </span>                                                        <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'2024年，大语言模型在技术突破、产业发展、多模态与多语言能力等方面取得了显著进展。 </span>                             <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">展望2025年，大语言模型将继续在个性化体验、对话式AI、科学研究、素 ...', 'position': 1}, {'title': </span>              <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'2024年大语言模型发展回顾与2025年展望- AI资讯- 冷月清谈', 'link': 'https://www.xinfinite.net/t/topic/9071', </span>   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'snippet': </span>                                                                                                    <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'2024年，大语言模型（LLM）在全球范围内取得了显著进展。OpenAI的o1模型在难题解决方面展现出超强实力；Meta发布了L</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">lama系列模型，包括最大的开源模型Llama ...', 'position': 2}, {'title': </span>                                         <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'大模型的2024，这可能是最早的一篇年度总结文！ - 华尔街见闻', 'link': </span>                                          <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://wallstreetcn.com/articles/3738174', 'snippet': </span>                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'2024年，大语言模型领域迎来另一重要突破：GPT-4级别的模型已可在普通个人电脑上运行。这打破了\"高性能AI模型必须依</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">赖昂贵数据中心\"的传统认知。 以64GB内存 ...', 'position': 3}, {'title': '[PDF] </span>                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">人工智能大语言模型技术发展研究报告（2024 年）', 'link': </span>                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://www.hulianhutongshequ.cn/upload/tank/report/2024/202407/1/bcdee24ec11a4f73a2c37a4cbdb2b61c.pdf', </span>     <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'snippet': '本报告总. 结梳理大语言模型技术能力进展和应用情况，并对未来发展. </span>                                   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">方向予以展望，以期为产业界提供参考。 由于编者水平所限，不妥之处，请批评指正。 Page 3 ...', 'position': 4}, </span>    <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">{'title': '多模态大语言模型领域进展分享（2024） 原创 - CSDN博客', 'link': </span>                                     <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://blog.csdn.net/youmaob/article/details/144745327', 'snippet': </span>                                         <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'随着人工智能技术的快速发展，多模态大语言模型（MLLM）正成为研究和应用的新热点。幻影视界今天分享的是：《多模态</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">大语言模型领域进展分享（2024）》， 报告 ...', 'position': 5}, {'title': '[PDF] </span>                                <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">人工智能大语言模型技术发展研究报告（2024 年）', 'link': </span>                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://a.nua.edu.cn/_upload/article/files/0c/07/aa8549444a97ae3ccae862227d19/0d28543d-148b-4905-8491-da829a</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">bf7d66.pdf', 'snippet': '阿里巴巴通义千问大模型在海量数据处理方面表现突. </span>                                      <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">出。通义千问基于最新的自然语言处理和生成技术，利用大. </span>                                                         <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">量的中英文文本进行训练，能够提供多语言对话和翻译服务。', 'position': 6}, {'title': '2024 年最佳大型语言模型 -</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">AIGC X', 'link': 'https://aigcx.com/2024-nian-zui-jia-da-xing-yu-yan-mo-xing/', 'snippet': 'OpenAI </span>            <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">最新开发的Sora 是一个文本生成视频模型，结合了大型语言模型（LLM）和生成式AI，能够将文本提示转换为最长60 </span>        <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">秒的真实感视频。该模型采用了一种基于 ...', 'position': 7}, {'title': '大语言模型简史. 2025年初 - Medium', </span>     <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'link': </span>                                                                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">'https://medium.com/@lmpo/%E5%A4%A7%E5%9E%8B%E8%AF%AD%E8%A8%80%E6%A8%A1%E5%9E%8B%E7%AE%80%E5%8F%B2-%E4%BB%8Et</span>  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">ransformer-2017-%E5%88%B0deepseek-r1-2025-cc54d658fb43', 'snippet': '在2023年至2024年间，...</span>                   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[32m╭─\u001b[0m\u001b[32m─────────────────────────────────────────────────\u001b[0m\u001b[32m Tool Output \u001b[0m\u001b[32m─────────────────────────────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m{'searchParameters': {'q': '语言模型 最新发展 2024', 'type': 'search', 'num': 10, 'engine': 'google'}, \u001b[0m        \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'organic': [{'title': '群英荟萃：盘点2024年的大语言模型 - 知乎专栏', 'link': \u001b[0m                                  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://zhuanlan.zhihu.com/p/13697531310', 'snippet': \u001b[0m                                                        \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'2024年，大语言模型在技术突破、产业发展、多模态与多语言能力等方面取得了显著进展。 \u001b[0m                             \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m展望2025年，大语言模型将继续在个性化体验、对话式AI、科学研究、素 ...', 'position': 1}, {'title': \u001b[0m              \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'2024年大语言模型发展回顾与2025年展望- AI资讯- 冷月清谈', 'link': 'https://www.xinfinite.net/t/topic/9071', \u001b[0m   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'snippet': \u001b[0m                                                                                                    \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'2024年，大语言模型（LLM）在全球范围内取得了显著进展。OpenAI的o1模型在难题解决方面展现出超强实力；Meta发布了L\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92mlama系列模型，包括最大的开源模型Llama ...', 'position': 2}, {'title': \u001b[0m                                         \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'大模型的2024，这可能是最早的一篇年度总结文！ - 华尔街见闻', 'link': \u001b[0m                                          \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://wallstreetcn.com/articles/3738174', 'snippet': \u001b[0m                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'2024年，大语言模型领域迎来另一重要突破：GPT-4级别的模型已可在普通个人电脑上运行。这打破了\"高性能AI模型必须依\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m赖昂贵数据中心\"的传统认知。 以64GB内存 ...', 'position': 3}, {'title': '[PDF] \u001b[0m                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m人工智能大语言模型技术发展研究报告（2024 年）', 'link': \u001b[0m                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://www.hulianhutongshequ.cn/upload/tank/report/2024/202407/1/bcdee24ec11a4f73a2c37a4cbdb2b61c.pdf', \u001b[0m     \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'snippet': '本报告总. 结梳理大语言模型技术能力进展和应用情况，并对未来发展. \u001b[0m                                   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m方向予以展望，以期为产业界提供参考。 由于编者水平所限，不妥之处，请批评指正。 Page 3 ...', 'position': 4}, \u001b[0m    \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m{'title': '多模态大语言模型领域进展分享（2024） 原创 - CSDN博客', 'link': \u001b[0m                                     \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://blog.csdn.net/youmaob/article/details/144745327', 'snippet': \u001b[0m                                         \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'随着人工智能技术的快速发展，多模态大语言模型（MLLM）正成为研究和应用的新热点。幻影视界今天分享的是：《多模态\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m大语言模型领域进展分享（2024）》， 报告 ...', 'position': 5}, {'title': '[PDF] \u001b[0m                                \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m人工智能大语言模型技术发展研究报告（2024 年）', 'link': \u001b[0m                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://a.nua.edu.cn/_upload/article/files/0c/07/aa8549444a97ae3ccae862227d19/0d28543d-148b-4905-8491-da829a\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92mbf7d66.pdf', 'snippet': '阿里巴巴通义千问大模型在海量数据处理方面表现突. \u001b[0m                                      \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m出。通义千问基于最新的自然语言处理和生成技术，利用大. \u001b[0m                                                         \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m量的中英文文本进行训练，能够提供多语言对话和翻译服务。', 'position': 6}, {'title': '2024 年最佳大型语言模型 -\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92mAIGC X', 'link': 'https://aigcx.com/2024-nian-zui-jia-da-xing-yu-yan-mo-xing/', 'snippet': 'OpenAI \u001b[0m            \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m最新开发的Sora 是一个文本生成视频模型，结合了大型语言模型（LLM）和生成式AI，能够将文本提示转换为最长60 \u001b[0m        \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m秒的真实感视频。该模型采用了一种基于 ...', 'position': 7}, {'title': '大语言模型简史. 2025年初 - Medium', \u001b[0m     \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'link': \u001b[0m                                                                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m'https://medium.com/@lmpo/%E5%A4%A7%E5%9E%8B%E8%AF%AD%E8%A8%80%E6%A8%A1%E5%9E%8B%E7%AE%80%E5%8F%B2-%E4%BB%8Et\u001b[0m  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92mransformer-2017-%E5%88%B0deepseek-r1-2025-cc54d658fb43', 'snippet': '在2023年至2024年间，...\u001b[0m                   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.10/dist-packages/rich/live.py:256: UserWarning: install \"ipywidgets\" for Jupyter support\n",
      "  warnings.warn('install \"ipywidgets\" for Jupyter support')\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2024年语言模型的最新发展主要包括：1. 技术突破，如OpenAI的o1模型在难题解决能力上表现突出，GPT-4级别模型可在普通PC运行；2. 多模态能力提升，如Sora模型整合文本、图像、视频等模态；3. 多语言支持，如通义千问提供多语言对话服务；4. 模型效率优化，如Meta的Llama系列开源模型；5. 应用场景扩展，包括科研、个性化体验等。详细信息可参考相关行业报告和学术论文。\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭───────────────────────────────────────────── ✅ Agent Final Answer ─────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Agent: </span><span style=\"color: #00ff00; text-decoration-color: #00ff00; font-weight: bold\">人工智能技术研究员</span>                                                                                      <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Final Answer:</span>                                                                                                  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">2024年语言模型的最新发展主要包括：1. </span>                                                                          <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">技术突破，如OpenAI的o1模型在难题解决能力上表现突出，GPT-4级别模型可在普通PC运行；2. </span>                           <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">多模态能力提升，如Sora模型整合文本、图像、视频等模态；3. 多语言支持，如通义千问提供多语言对话服务；4. </span>         <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">模型效率优化，如Meta的Llama系列开源模型；5. </span>                                                                   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #00ff00; text-decoration-color: #00ff00\">应用场景扩展，包括科研、个性化体验等。详细信息可参考相关行业报告和学术论文。</span>                                   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[32m╭─\u001b[0m\u001b[32m────────────────────────────────────────────\u001b[0m\u001b[32m ✅ Agent Final Answer \u001b[0m\u001b[32m────────────────────────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mAgent: \u001b[0m\u001b[1;92m人工智能技术研究员\u001b[0m                                                                                      \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mFinal Answer:\u001b[0m                                                                                                  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m2024年语言模型的最新发展主要包括：1. \u001b[0m                                                                          \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m技术突破，如OpenAI的o1模型在难题解决能力上表现突出，GPT-4级别模型可在普通PC运行；2. \u001b[0m                           \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m多模态能力提升，如Sora模型整合文本、图像、视频等模态；3. 多语言支持，如通义千问提供多语言对话服务；4. \u001b[0m         \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m模型效率优化，如Meta的Llama系列开源模型；5. \u001b[0m                                                                   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[92m应用场景扩展，包括科研、个性化体验等。详细信息可参考相关行业报告和学术论文。\u001b[0m                                   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008000; text-decoration-color: #008000\">╭───────────────────────────────────────────── LiteAgent Completion ──────────────────────────────────────────────╮</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000; font-weight: bold\">LiteAgent Completed</span>                                                                                            <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Name: </span><span style=\"color: #008000; text-decoration-color: #008000\">人工智能技术研究员</span>                                                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">id: </span><span style=\"color: #008000; text-decoration-color: #008000\">bef1ce9b-cd99-47d6-8ad7-eea01bfa2363</span>                                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">role: </span><span style=\"color: #008000; text-decoration-color: #008000\">人工智能技术研究员</span>                                                                                       <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">goal: </span><span style=\"color: #008000; text-decoration-color: #008000\">研究最新的人工智能发展动态</span>                                                                               <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">backstory: </span>                                                                                                    <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">拥有10年AI领域研究经验，专注于自然语言处理和大语言模型方向，擅长跟踪学术前沿和产业动态，能快速筛选有价值的信</span>   <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">息。</span>                                                                                                           <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">tools: </span><span style=\"color: #008000; text-decoration-color: #008000\">[CrewStructuredTool(name='Search the internet with Serper', description='Tool Name: Search the </span>         <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">internet with Serper</span>                                                                                           <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">Tool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the </span>        <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">internet', 'type': 'str'}}</span>                                                                                     <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">Tool Description: A tool that can be used to search the internet with a search_query. Supports different </span>      <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #008000; text-decoration-color: #008000\">search types: 'search' (default), 'news'')]</span>                                                                    <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">verbose: </span><span style=\"color: #008000; text-decoration-color: #008000\">True</span>                                                                                                  <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>  <span style=\"color: #c0c0c0; text-decoration-color: #c0c0c0\">Tool Args: </span>                                                                                                    <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">│</span>                                                                                                                 <span style=\"color: #008000; text-decoration-color: #008000\">│</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[32m╭─\u001b[0m\u001b[32m────────────────────────────────────────────\u001b[0m\u001b[32m LiteAgent Completion \u001b[0m\u001b[32m─────────────────────────────────────────────\u001b[0m\u001b[32m─╮\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[1;32mLiteAgent Completed\u001b[0m                                                                                            \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mName: \u001b[0m\u001b[32m人工智能技术研究员\u001b[0m                                                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mid: \u001b[0m\u001b[32mbef1ce9b-cd99-47d6-8ad7-eea01bfa2363\u001b[0m                                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mrole: \u001b[0m\u001b[32m人工智能技术研究员\u001b[0m                                                                                       \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mgoal: \u001b[0m\u001b[32m研究最新的人工智能发展动态\u001b[0m                                                                               \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mbackstory: \u001b[0m                                                                                                    \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32m拥有10年AI领域研究经验，专注于自然语言处理和大语言模型方向，擅长跟踪学术前沿和产业动态，能快速筛选有价值的信\u001b[0m   \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32m息。\u001b[0m                                                                                                           \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mtools: \u001b[0m\u001b[32m[CrewStructuredTool(name='Search the internet with Serper', description='Tool Name: Search the \u001b[0m         \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32minternet with Serper\u001b[0m                                                                                           \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32mTool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the \u001b[0m        \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32minternet', 'type': 'str'}}\u001b[0m                                                                                     \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32mTool Description: A tool that can be used to search the internet with a search_query. Supports different \u001b[0m      \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[32msearch types: 'search' (default), 'news'')]\u001b[0m                                                                    \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mverbose: \u001b[0m\u001b[32mTrue\u001b[0m                                                                                                  \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m  \u001b[37mTool Args: \u001b[0m                                                                                                    \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m│\u001b[0m                                                                                                                 \u001b[32m│\u001b[0m\n",
       "\u001b[32m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 使用 `kickoff()` 直接与智能体交互\n",
    "# 可以使用 `kickoff()` 方法直接使用智能体，而无需通过任务或团队工作流。当您不需要完整的团队编排功能时，这提供了一种更简单的与智能体交互的方式。\n",
    "# ​\n",
    "# `kickoff()` 如何工作\n",
    "# `kickoff()` 方法允许您直接向智能体发送消息并获得响应，类似于您与 LLM 的交互方式，但具有智能体的所有功能（工具、推理等）。\n",
    "\n",
    "# Serper API配置（用于网络搜索）\n",
    "# 注册链接https://serper.dev/api-keys 去这里找\n",
    "\n",
    "from crewai import Agent\n",
    "from crewai_tools import SerperDevTool\n",
    "\n",
    "# 创建智能体\n",
    "researcher = Agent(\n",
    "    role=\"人工智能技术研究员\",  # 智能体的角色：人工智能技术研究员\n",
    "    goal=\"研究最新的人工智能发展动态\",  # 智能体的目标：研究人工智能领域的最新进展\n",
    "    backstory=\"拥有10年AI领域研究经验，专注于自然语言处理和大语言模型方向，擅长跟踪学术前沿和产业动态，能快速筛选有价值的信息。\",  # 补充背景故事（必填）\n",
    "    tools=[SerperDevTool()],  # 工具：使用SerperDevTool（用于网络搜索获取最新信息）\n",
    "    verbose=True  # 开启详细日志模式\n",
    ")\n",
    "\n",
    "# 使用kickoff()直接与智能体交互\n",
    "result = researcher.kickoff(\"语言模型的最新发展有哪些？\")\n",
    "# 获取原始响应结果\n",
    "print(result.raw)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
